home *** CD-ROM | disk | FTP | other *** search
- Path: arlut.utexas.edu!usenet
- From: Lee Crites <crites>
- Newsgroups: comp.lang.c++
- Subject: Problems with STL compiling...
- Date: 15 Jan 1996 19:46:31 GMT
- Organization: Applied Research Laboratories - The University of Texas at Austin
- Message-ID: <4deaun$o94@ns1.arlut.utexas.edu>
- NNTP-Posting-Host: squid.arlut.utexas.edu
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.1N (X11; I; HP-UX A.09.01 9000/730)
- X-URL: news:comp.lang.c++
-
- I'm just trying my first compile of programs using the STL. I'm using an
- example program from Nelson's book _C++_Programmer's_Guide_to_the_STL. I
- started with the latest version of the stl straight from hp, and then started
- testing witht the version included with the book. My results were identicle
- either way.
-
- For those with the book, I'm trying to get the first program to compile,
- VECT0401.CPP. (I've gone through and changed all of the uppercase include
- names to lower case, but that's the only change made to his originals)
-
- I'm having problems with vector.h. Here are the lines in question:
-
- from vector.h:
-
- template <class T>
- class vector {
- public:
-
- typedef Allocator<T> vector_allocator;
- typedef T value_type;
- typedef vector_allocator::pointer pointer; // this is line 38
- typedef vector_allocator::pointer iterator;
- typedef vector_allocator::const_pointer const_iterator;
- typedef vector_allocator::reference reference;
- typedef vector_allocator::const_reference const_reference;
- typedef vector_allocator::size_type size_type;
- typedef vector_allocator::difference_type difference_type;
- typedef reverse_iterator<const_iterator, value_type, const_reference,
- difference_type> const_reverse_iterator;
- typedef reverse_iterator<iterator, value_type, reference, difference_type>
- reverse_iterator;
- ..
- ..
-
-
- The error messages:
-
- /opt/bin/CC -g +w -I/usr/include -Iinclude -I. -I/usr/stl/include -o vect0401
- vect0401.cpp
- "/usr/stl/include/defalloc.h", line 26: Warning (Anachronism): operator
- new(unsigned, void*) was previously declared "extern", not "inline".
- "/usr/stl/include/defalloc.h", line 26: Note: Type "CC -migration" for more on
- anachronisms.
- "/usr/stl/include/vector.h", line 38: Warning: A qualifier is not allowed for
- pointer.
- "vect0401.cpp", line 34: Where: While specializing vector<double>.
- "vect0401.cpp", line 34: Where: Specialized in non-template code.
- "/usr/stl/include/vector.h", line 38: Error: "," expected instead of "pointer".
- "vect0401.cpp", line 34: Where: While specializing vector<double>.
- "vect0401.cpp", line 34: Where: Specialized in non-template code.
- "/usr/stl/include/vector.h", line 39: Error: Use ";" to terminate declarations.
- "vect0401.cpp", line 34: Where: While specializing vector<double>.
- "vect0401.cpp", line 34: Where: Specialized in non-template code.
- 2 Error(s) and 2 Warning(s) detected.
- *** Error code 2
-
- Other stuff:
-
- running on a Sun, using SunOs5.4
-
- changing the pointer to something else (like va_pointer) only changes the text
- in the error messages. (thinking that the string 'pointer' was used someplace
- else and that was the problem)
-
- I can send full source code if anyone needs it.
-
- So my main question is this: what do I need to do to fix this? Is there
- something wrong with my compiler (everyone else can compile with without
- changes?!?) or am I missing something (like an obscure include file)?
-
- Any help would be appreciated...
-
- Lee
-
-